<%@ page import="java.util.Random" %><%--
  Created by IntelliJ IDEA.
  User: 21257
  Date: 2020/8/14
  Time: 20:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%request.getAttribute("msg");
if(request.getAttribute("msg")==null){

}else{
    out.print(request.getAttribute("msg"));
}
%>
<form action="../LoginServlet" method="get" autocomplete="on">
    用&nbsp;&nbsp;户&nbsp; &nbsp;&nbsp;名：<input type="text" name="username"><br>
    密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="password" name="password"><br>
    输入验证码：<input type="text" name="yan" required>
    <% { Random random = new Random();
    String s="";
        for (int i = 0; i < 4; i++) {
            char j = (char) (random.nextInt(26)+65);
            s+=j;
        }
        HttpSession sse = request.getSession();
        sse.setAttribute("yan",s);
       %>
    <input type="button" value=<%=s%>  >
    <%}%>
    <br>
    <input type="submit" value="登录" >
    &nbsp;&nbsp;&nbsp;<input type="reset" value="清除">
</form>
</body>
</html>
